/**
 */
package de.thwildau.tm.moses.abnf.abnf.impl;

import de.thwildau.tm.moses.abnf.abnf.AbnfPackage;
import de.thwildau.tm.moses.abnf.abnf.Concatenation;
import de.thwildau.tm.moses.abnf.abnf.Repetition;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Concatenation</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.abnf.abnf.impl.ConcatenationImpl#getRepetitions <em>Repetitions</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConcatenationImpl extends MinimalEObjectImpl.Container implements Concatenation
{
  /**
   * The cached value of the '{@link #getRepetitions() <em>Repetitions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRepetitions()
   * @generated
   * @ordered
   */
  protected EList<Repetition> repetitions;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ConcatenationImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AbnfPackage.Literals.CONCATENATION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Repetition> getRepetitions()
  {
    if (repetitions == null)
    {
      repetitions = new EObjectContainmentEList<Repetition>(Repetition.class, this, AbnfPackage.CONCATENATION__REPETITIONS);
    }
    return repetitions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case AbnfPackage.CONCATENATION__REPETITIONS:
        return ((InternalEList<?>)getRepetitions()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AbnfPackage.CONCATENATION__REPETITIONS:
        return getRepetitions();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AbnfPackage.CONCATENATION__REPETITIONS:
        getRepetitions().clear();
        getRepetitions().addAll((Collection<? extends Repetition>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AbnfPackage.CONCATENATION__REPETITIONS:
        getRepetitions().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AbnfPackage.CONCATENATION__REPETITIONS:
        return repetitions != null && !repetitions.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ConcatenationImpl
